unit UGravity;

interface

uses SysUtils, Windows, Classes, Math, UMapObjekte, UPictureName, UPlayer;

type
  TGravity = class(TMapObject) // 12
  private
  public
    constructor Create(Id: integer); Override;
    function getCollisionAtPixel(Game: TObject; X, Y: integer): integer;
      Override;
  end;

implementation

uses UGame;
{ TGravity }

constructor TGravity.Create(Id: integer);
begin
  self.Id := Id;
  self.Num := 12;
  FPictureName := b_Gravity;
end;

function TGravity.getCollisionAtPixel(Game: TObject; X, Y: integer): integer;
var
  vgame: TGame;
begin
  vgame := Game as TGame;
  if ((vgame.getTexturePack.GetNamedPicture(self.PictureName)
        .Bitmap.Canvas.Pixels[X, Y] = RGB(250, 0, 250)) or
      (vgame.getTexturePack.GetNamedPicture(self.PictureName)
        .Bitmap.Canvas.Pixels[X, Y] = -1) or (vgame.getTexturePack.GetNamedPicture(self.PictureName).Bitmap.Canvas.Pixels[X, Y] = RGB(255, 255, 255)) or (vgame.getTexturePack.GetNamedPicture(self.PictureName).Bitmap.Canvas.Pixels[X, Y] = RGB(0, 0, 0))) then begin
    result := 0
        end else begin
    result := 5;
  end;

end;

end.
